package com.pkk.cloud.support.gateway.limiter.global.properties;

import static com.pkk.cloud.support.gateway.limiter.global.constand.GlobalLimitConstand.DEFAULT_GLOBAL_LIMIT;

import com.pkk.cloud.support.gateway.limiter.global.config.GlobalLimitConfig;
import com.pkk.cloud.support.gateway.limiter.global.util.GlobalMethodRateLimitUtil;
import java.io.Serializable;
import lombok.Data;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Import;

/**
 * @description: 启用全局过滤器配置
 * @author: peikunkun
 * @create: 2020-03-24 11:00
 **/
@Data
@ConfigurationProperties(prefix = "com.pkk.cloud.support.gateway.limiter.global")
@AutoConfigureBefore({GlobalLimitConfig.class, GlobalMethodRateLimitUtil.class})
@Import({GlobalLimitConfig.class, GlobalMethodRateLimitUtil.class})
public class GlobalRateLimitProperties implements Serializable {

  private static final long serialVersionUID = -5850985567959925980L;


  /**
   * 是否开启全局请求配置
   */
  private boolean enable = false;


  /**
   * 限制一秒最大的请求
   */
  private Integer limitNum = DEFAULT_GLOBAL_LIMIT;

  /**
   * 方法接口的限制配置
   */
  private GlobalMethodRateLimitProperties method;


}
